//b进程获取
#include "comm.hpp"
int main()
{
    int shmid=GetShm();
    log(DEBUG,"Creat success !! shmid is :%x",shmid);
    
    //第三步挂载到进程地址空
    char*shmptr=(char*)shmat(shmid,NULL,0);

    
    //打开写管道
    int fd=open(FIFOFILE_NAME,O_WRONLY);

    //第四步 使用共享内存空间通信
    while(true)
    {
       std:: cout<<"please enter@";
       fgets(shmptr,SHMSIZE,stdin);

        write(fd,"c",1);
    }
    //第五步 取消关联
    sleep(2);
    int n=shmdt(shmptr);
    if(n<0)
    {
        log(ERROR,"取消关联失败 ! error message:%s  error code: %d",strerror(errno),errno);
        exit(SHMDT_ERR);
    } 
    close(fd);
    //不用释放？
    // //释放共享内存
    // sleep(30);
    // shmctl(retshm,IPC_RMID,nullptr);
    return 0;
}